<?php
require '../model/topicDao.php';

if($_SERVER["REQUEST_METHOD"] == "POST") {
    $topicId = $_POST['topicId'];
    $title = $_POST['title'];
    $content = $_POST['content'];
    
    $result = update_topic($topicId, $title, $content);
    
    if($result) {
        header("location:../views/me.php");
    } else {
        echo json_encode(["status" => "error", "message" => "更新失败"]);
    }
} else {
    header("location:../views/error.php?msg=非法访问");
}
?> 